<?php
class Cip_servers_m extends MY_Model {
	/**
	 * Insert a new category into the database
	 * @access public
	 * @param array $input The data to insert
	 * @return string
	 */
	public function insert($input = array())
	{
		$this->load->helper('text');
		parent::insert(array(
			'name'	=> $input['name'],
			'domain_name'	=> $input['domain_name'],
			'database_user'	=> $input['database_user'],
			'database_name'	=> $input['database_name'],
			'database_password 	'	=> $input['database_password'],
			'create_date'	=> time()
		));
		
		return $input['name'];
	}
	/**
	 * Update an existing category
	 * @access public
	 * @param int $id The ID of the category
	 * @param array $input The data to update
	 * @return bool
	 */
	public function update($id, $input)
	{
		return parent::update($id, array(
			'name'	=> $input['name'],
			'domain_name'	=> $input['domain_name'],
			'database_user'	=> $input['database_user'],
			'database_name'	=> $input['database_name'],
			'database_password 	'	=> $input['database_password']
		));
	}
	/**
	 * Callback method for validating the title
	 * @access public
	 * @param string $title The title to validate
	 * @return mixed
	 */
	public function check_title($title = '')
	{
		return parent::count_by('name', $title) > 0;
	}
}